#!/usr/bin/env python
# -*- coding: utf-8 -*-

class SchoolMember(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age
        # self.print_msg()

    def print_msg(self):
        print 'name:%s, age:%d' %(self.name, self.age)


class SchoolTeacher(SchoolMember):
    def __init__(self, name, age, sex, p_id):
        ## SchoolMember.__init__(self, name, age)
        super(SchoolTeacher, self).__init__(name, age)
        self.sex = sex
        self.p_id = p_id

    def print_msg_teacher(self):
        print 'name:%s, age:%d, sex:%s, id:%d' %(self.name, self.age, self.sex, self.p_id)


class SchoolStudent(SchoolMember):
    def __init__(self, name, age, addr):
        ## SchoolMember.__init__(self, name, age)
        super(SchoolStudent, self).__init__(name, age)
        self.addr = addr

    def print_msg_student(self):
        print 'name:%s, age:%d, addr:%s' %(self.name, self.age, self.addr)

    def __unicode__(self):
        print self.name

        
class SchoolCommon(SchoolStudent, SchoolTeacher):
    def __init__(self, name, age, addr, sex, p_id):
        SchoolStudent.__init__(self, name, age, addr)
        SchoolTeacher.__init__(self, name, age, sex, p_id)

    def print_msg_common(self):
        print 'name:%s, age:%d, sex:%s, addr:%s, id:%d' %(self.name, self.age, self.sex, self.addr, self.p_id)


def read_conf_file(file):
    with open(file) as f:
        while True:
            line = f.readline()
            if len(line) == 0: break

            # skip the blank line
            line2 = line.strip()  
            if len(line2) == 0: continue

            # skip the comments
            if line2.startswith('#') or line2.startswith(';'): continue
            
            if '=' not in line2:
                print 'group: %s' %(line2)
            else:
                print 'key(%s) = value(%s)' % (tuple(line2.split('=')))


if __name__ == "__main__":
    s_member = SchoolMember('cheng1', 29)
    s_teacher = SchoolTeacher('TeacherWang', 39, 'boy', 2202)
    s_student = SchoolStudent('StudentLiu', 19, 'shichuang meishan shanshu')
    member = []
    member.append(s_member)
    member.append(s_teacher)
    member.append(s_student)
    for tmp in member:
        tmp.print_msg()
    s_teacher.print_msg_teacher()
    s_student.print_msg_student()
